package com.yuwei.visit

import android.app.DatePickerDialog
import android.app.TimePickerDialog
import android.widget.DatePicker
import com.alibaba.android.arouter.facade.annotation.Route
import com.yuwei.base.BaseActivity
import com.yuwei.base.path.RouterPath
import com.yuwei.visit.databinding.ActivityAddVisitBinding
import com.yuwei.visit.viewmodel.VisitVIewModel
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
@Route(path = RouterPath.MODULE_ADD_VISIT_ACTIVITY)
class AddVisitActivity : BaseActivity<ActivityAddVisitBinding,VisitVIewModel>() {
    override fun initView() {
        binding.addVisitDataView.setOnClickListener {
            DatePickerDialog(this,
                { view, year, month, dayOfMonth ->
                    binding.addVisitData.text = "$year-${month+1}-$dayOfMonth"
                }, 2021, 1, 1).show()
        }
        binding.addVisitStartTime.setOnClickListener {
            TimePickerDialog(this,
                { view, hourOfDay, minute ->
                    binding.addVisitStartTime.text = "$hourOfDay:$minute"
                }, 10, 10, true).show()
        }
        binding.addVisitEndTime.setOnClickListener {
            TimePickerDialog(this,
                { view, hourOfDay, minute ->
                    binding.addVisitEndTime.text = "$hourOfDay:$minute"
                }, 10, 10, true).show()
        }
        binding.visitBack.setOnClickListener {
            finish()
        }
        binding.addVisitParkingSwitch.setOnClickListener {
            val selected = it.isSelected
            binding.addVisitCarNum.isEnabled = selected
        }
    }

    override fun initData() {

    }

}